package developer.zyk.global.common.consts;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.ai.chat.messages.MessageType;

import java.util.Objects;

/**
 * @author zhangyongkang
 * @time 2025/4/30 16:11
 * @description
 */
@AllArgsConstructor
@Getter
public enum ChatRole {
    USER("user", MessageType.USER),
    SYSTEM("system", MessageType.SYSTEM),
    ASSISTANT("assistant", MessageType.ASSISTANT),
    TOOL("tool", MessageType.TOOL),
    ;
    private final String role;
    private final MessageType messageType;

    public static ChatRole queryByRoleCode(String code) {
        for (ChatRole value : values()) {
            if (Objects.equals(value.role, code)) {
                return value;
            }
        }
        return null;
    }
}
